<template>
    <div class="usercenter">
    <div class="header">
      <div class="header_title">
        <div class="title_avatar">
          <img :src="business.avatar_cdn" />
        </div>
        <div class="title_content">
          <div class="content_text">{{ business.nickname }}</div>
          <div class="content_sm">{{ business.createtime_date }}</div>
        </div>
      </div>
    </div>
    <div class="userorder">
      <div class="order_project">
        <div class="item">
          <router-link to="/sale/index" class="item">
            <div class="img"> <img src="/assets/images/retail1.png" alt=""></div>
            分销信息
          </router-link>
        </div>
        <div class="item">
          <router-link to="/sale/business" class="item">
            <div class="img"> <img src="/assets/images/retail2.png" alt=""></div>
            分销会员
          </router-link>
        </div>
        <div class="item">
          <router-link to="/sale/money" class="item">
            <div class="img"> <img src="/assets/images/retail3.png" alt=""></div>
            分销佣金
          </router-link>
        </div>
        <div class="item">
          <router-link to="/business/coupon" class="item">
            <div class="img"> <img src="/assets/images/coupon.png" alt=""></div>
            优惠列表
          </router-link>
        </div>
        <div class="item solid-left">
          <router-link to="/business/pay" class="item">
            <div class="img"> <img src="/assets/images/recharge2.png" alt=""></div>
            充值中心
          </router-link>
        </div>
      </div>
    </div>
    <div class="usertool">
      <div class="list">
        <div class="item">
          <router-link to="/business/profile">
            <div class="img">
              <img src="/assets/images/profile.png" alt="">
            </div>
            基本资料
          </router-link>
        </div>
        <div class="item">
          <a @click="ToEmail">
            <div class="img"> <img src="/assets/images/email.png" alt=""></div>
            邮箱认证
          </a>
        </div>
        <div class="item">
          <router-link to="/address">
            <div class="img"> <img src="/assets/images/address.png" alt=""></div>
            收货地址
          </router-link>
        </div>
        <div class="item">
          <router-link to="/business/record">
            <div class="img">
              <img src="/assets/images/consume.png" alt="">
            </div>
            消费记录
          </router-link>
        </div>
        <div class="item">
          <router-link to="/order">
            <div class="img">
              <img src="/assets/images/recharge2.png" alt="">
            </div>
            我的订单
          </router-link>
        </div>
        <div class="item">
          <router-link to="/share">
            <div class="img">
              <img src="/assets/images/quanbu.png" alt="">
            </div>
            种草分享
          </router-link>
        </div>
        <div class="item">
          <a href="javascript:void(0)" @click="onLogout">
            <div class="img">
              <img src="/assets/images/returns.png" alt="">
            </div>
            退出登录
          </a>
        </div>
      </div>
    </div>
    <div class="userorder">
      <ul class="proul">
        <li>
          <router-link to="/product/info"><img src="/assets/images/7.jpg" /></router-link>
          <router-link to="/product/info">
            <p class="tit">北欧轻奢餐椅家用现代简约新中式洽谈酒店皮革软包餐厅椅子靠背椅</p>
          </router-link>
          <div class="price">
            <p>￥2998</p>
          </div>
        </li>
        <li>
          <router-link to="/product/info"><img src="/assets/images/4.jpg" /></router-link>
          <router-link to="/product/info">
            <p class="tit">松兰宾利实木餐桌椅组合后现代轻奢长方形大户型不锈钢8人饭桌</p>
          </router-link>
          <div class="price">
            <p>￥998</p>
          </div>
        </li>
        <li>
          <router-link to="/product/info"><img src="/assets/images/5.jpg" /></router-link>
          <router-link to="/product/info">
            <p class="tit">卫生间洗手台柜面池洗睑台式壁挂台盆架瓷盥洗池饭店小号挂盆经济</p>
          </router-link>
          <div class="price">
            <p>￥368</p>
          </div>
        </li>
        <li>
          <router-link to="/product/info"><img src="/assets/images/6.jpg" /></router-link>
          <router-link to="/product/info">
            <p class="tit">布艺床主卧大床双人床港式轻奢ins网红床卧室北欧家具床现代简约</p>
          </router-link>
          <div class="price">
            <p>￥3998</p>
          </div>
        </li>
      </ul>
    </div>

    <Tabbar />
  </div>
</template>

<script setup>

const { proxy } = getCurrentInstance();

const business = proxy.$business;
const onLogout = () =>
{
    proxy.$confirm({
        title:'退出登录',
        message:'是否确认退出当前账号？'
    }).then(() => {
        proxy.$success({
            message:'退出登录成功',
            onClose:() =>
            {
                proxy.$ResetBusiness();

                proxy.$router.push('/business/login');
            }
        })
    }).catch(() => {});
}

const ToEmail = () =>
{
  if(business.value.auth == 1)
  {
    if(business.value.auth == 1)
      {
          proxy.$success('您已认证成功，无须重复认证');

          return false;
      }
      
  }

  if(!business.value.email)
    {
        proxy.$warning('请去基本资料补充邮箱地址');

        return false;
    }

  proxy.$router.push('/business/email');


}

</script>

<style scoped>
    @import url('/assets/css/BusinessIndex.css');
</style>